package com.spring.demo.test;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.spring.demo.conf.AppConf;
import com.spring.demo.service.OrderService;

public class MainCase {

	public static void main(String[] args) {
		AnnotationConfigApplicationContext ac=new AnnotationConfigApplicationContext();
		ac.register(AppConf.class);
		ac.refresh();
		 //能成功从容器中获取orderService,并成功调用orderService.query();方法
        OrderService orderService = ac.getBean(OrderService.class);
        orderService.query();
        OrderService orderService2 = ac.getBean(OrderService.class);
        //false,orderService已经不是单例
        System.out.println(orderService == orderService2);
        ac.close();
	}
}
